<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\Models\Leave;
use App\Models\Service;
use Illuminate\Http\Request;

class ServiceController extends Controller
{
    //
    /**
     * 客服列表展示
     * @yuankai
     */
    public function service_index(Request $request)
    {
        if ($request->method() == 'GET'){
            try {
                $res = Service::list();
                if ($res){
                    return common::success(20000,$res,'查询成功');
                }
            }catch (\Exception $exception)
            {
                return common::fail('','',$exception->getMessage());
            }
        }else{
            return common::fail('','','请求方式不正确');
        }
    }

    /**
     * 客户留言列表展示
     * @yuankai
     */
    public function leaver_index(Request $request)
    {
        if ($request->method() == 'GET'){
            try {
                $res = Leave::list();
                if ($res){
                    return common::success(20000,$res,'查询成功');
                }
            }catch (\Exception $exception)
            {
                return common::fail('','',$exception->getMessage());
            }
        }else {
            return common::fail('', '', '请求方式不正确');
        }
    }
}
